package org.zcz.packing.tool.handler;

import org.zcz.packing.tool.config.ProjectConfig;
import org.zcz.packing.tool.util.PackageUtil;

import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author zhangcz
 * @title: ResourcesFileHandler
 * @projectName svnpackageutil
 * @description: TODO
 * @date 2019/6/199:33
 */
public class ResourcesFileHandler implements HandlerInterface {
    public void handler(List<Map<String, String>> copyList, String svnPath, ProjectConfig config, String packagePath) {
        String sourcePath = config.getProjectPath() + File.separator + BYTTER_BUILD + File.separator + WEB_INF + File.separator + CLASSES;
        String packageFilePath = packagePath + File.separator + WEB + File.separator + WEB_INF + File.separator + CLASSES;

        String[] pathSplit = svnPath.split(RESOURCE_DELIMITER);
        String resourcesPathInProject = pathSplit[1];

        String source = sourcePath + resourcesPathInProject;
        String dist = packageFilePath + resourcesPathInProject;
        Map<String, String> pathMap = new HashMap<String, String>();
        pathMap.put(PackageUtil.SOURCE,source);
        pathMap.put(PackageUtil.DEST,dist);
        copyList.add(pathMap);
    }
}
